﻿using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;

namespace WorkFlowCore.Common.Authorization.JWT
{
    public interface ICustomizationVerify
    {
        VerifyOutput Verify(VerifyInput input);
    }


    public class VerifyInput
    {
        /// <summary>
        /// 请求上下文
        /// </summary>
        public HttpContext Context { get; set; }
        /// <summary>
        /// 来自接口请求传递  access_token 头部
        /// </summary>
        [Obsolete("请通过 AccessToken 访问")]
        public string OriginalToken => AccessToken;
        /// <summary>
        /// 来自接口请求传递  access_token 头部
        /// </summary>
        public string AccessToken { get; set; }
        /// <summary>
        /// 应用id
        /// </summary>
        public string AppId { get; set; }
        /// <summary>
        /// 第三方 token，如果没有取到 ，则默认与 accesstoken 一致
        /// </summary>
        public string ThirdPartToken { get; set; }
    }

    public class VerifyOutput
    {
        public bool IsValid { get; set; }
        public AuthorizationUser User { get; set; }
        public Claim[] Claims { get; set; }
    }
}
